/*
 * @Copyright: 2025 Copyright (C) AMCAX, All rights reserved.
 * @Author: Zhang
 * @Date: 2025/7/29 11:19
 * @LastEditTime: 2025/7/29 11:19
 * @LastEditors: Zhang
 * @Description:
 */

import { i18n } from '@/common/utils';
import { RJSFSchema, UiSchema } from '@rjsf/utils';
import { CollapseTemplate } from 'nextcae-base';

const titles = {
  source: i18n.t('public.Source'),
};
export const schema: RJSFSchema = {
  type: 'object',
  properties: {
    Options: {
      type: 'object',
      title: i18n.t('public.option'),
      properties: {
        typeOptions: {
          title: i18n.t('featureInfo.featureType'),
          type: 'string',
          default: 'Plane',
        },
      },
    },
    Selection: {
      type: 'object',
      title: i18n.t('public.Selection'),
      properties: {
        source: {
          title: titles.source,
          type: 'string',
          default: i18n.t('featureInfo.unitPicking'),
        },
      },
    },
  },
};

export const uiSchema: UiSchema = {
  Selection: {
    'ui:FieldTemplate': CollapseTemplate,
    'ui:selectKey': titles.source, // title 显示的字段
    'ui:layout': [1, 2],
    'ui:options': {
      label: false, // 不显示 label
    },
    source: {
      'ui:field': 'selectionField',
      'ui:options': {
        isPicker: true,
        options: [
          {
            const: 'unitPicking',
            title: i18n.t('featureInfo.unitPicking'),
          },
        ],
      },
    },
  },
  Options: {
    'ui:FieldTemplate': CollapseTemplate,
    'ui:layout': [2, 7],
    'ui:options': {
      label: false,
    },
    typeOptions: {
      'ui:field': 'selectionField',
      'ui:options': {
        options: [
          {
            const: 'Plane',
            title: i18n.t('featureInfo.plane'),
          },
          {
            const: 'Notes',
            title: i18n.t('featureInfo.notes'),
          },
          {
            const: 'Cylindrical',
            title: i18n.t('featureInfo.cylindrical'),
          },
          {
            const: 'Cone',
            title: i18n.t('featureInfo.cone'),
          },
          {
            const: 'Disc',
            title: i18n.t('featureInfo.disc'),
          },
          {
            const: 'Ball',
            title: i18n.t('featureInfo.ball'),
          },
        ],
      },
    },
  },
};
